﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharpShare.Storage {
    public class StorageException : Exception {
        public StorageException(string message = null, Exception innerException = null)
            : base(message, innerException) {

        }
    }

    /// <summary>
    /// Thrown by DemandFile and DemandContainer when the storage item isn't of the demanded type.
    /// </summary>
    public class StorageItemInvalidTypeException : StorageException {
        public StorageItemInvalidTypeException()
            : base("Storage item is not of the right type.") {

        }
    }

    /// <summary>
    /// Indicates the file is already open by someone else who prohibits sharing in the manner requested.
    /// </summary>
    public class StorageFileConflictException : StorageException {
        public StorageFileConflictException(Exception innerException = null)
            : base("Access mode conflict.", innerException) {

        }
    }

    /// <summary>
    /// Indicates the storage item was not found.
    /// </summary>
    public class StorageItemNotFoundException : StorageException {
        public StorageItemNotFoundException(Exception innerException = null)
            : base("Storage item does not exist.", innerException) {

        }
    }

    /// <summary>
    /// Indicates the storage container was not found.
    /// </summary>
    public class StorageContainerNotFoundException : StorageException {
        public StorageContainerNotFoundException(Exception innerException = null)
            : base("Storage container does not exist.", innerException) {

        }
    }

    /// <summary>
    /// Thrown when calling Delete on a storage container that is not empty.
    /// </summary>
    public class StorageContainerNotEmptyException : StorageException {
        public StorageContainerNotEmptyException(Exception innerException = null)
            : base("Storage container is not empty.", innerException) {

        }
    }

    /// <summary>
    /// Thrown when calling Delete on a storage item that can't be deleted.
    /// </summary>
    public class StorageItemLockedException : StorageException {
        public StorageItemLockedException(Exception innerException = null)
            : base("Storage item is locked.", innerException) {

        }
    }

    /// <summary>
    /// Thrown when trying to delete a storage item that is in use.
    /// </summary>
    public class StorageItemInUseException : StorageException {
        public StorageItemInUseException(Exception innerException = null)
            : base("Storage item is in use.", innerException) {

        }
    }

    /// <summary>
    /// Thrown when trying to access a storage item without permission.
    /// </summary>
    public class StorageItemUnauthorizedException : StorageException {
        public StorageItemUnauthorizedException(Exception innerException = null)
            : base("Unauthorized access to storage item.", innerException) {

        }
    }

    /// <summary>
    /// Thrown when the storage container is full.
    /// </summary>
    public class StorageContainerFullException : StorageException {
        public StorageContainerFullException(Exception innerException = null)
            : base("Storage container is full.", innerException) {

        }
    }

    /// <summary>
    /// Thrown when renaming or creating when a storage item already exists with that name.
    /// </summary>
    public class StorageItemAlreadyExistsException : StorageException {
        public StorageItemAlreadyExistsException(Exception innerException = null)
            : base("Storage item already exists.", innerException) {

        }
    }
}
